package cn.bone.demo.mongo;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by MD-01 on 2016/10/13.
 */
public class DateAdapter extends TypeAdapter<Date> {
    @Override
    public void write(JsonWriter out, Date value) throws IOException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        out.value(sdf.format(value));
    }

    @Override
    public Date read(JsonReader in) throws IOException {
        return null;
    }
}
